<!DOCTYPE html>
<html>
<head>
    <title>添加医生--中软高科-2015</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../layer/layer.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <script type="text/javascript" src="../Js/ckeditor/ckeditor.js"></script>
 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
    $(function () {       
		$('#backId').click(function(){
				window.location.href="index.html";
		 });
    });
    </script>
</head>
<body>
<form action="#" id="myForm" class="definewidth m20">
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">姓名</td>
        <td><input type="text" name="d_name" onclick="checkName()" value="张三"/></td>
    </tr>
    
    <tr>
        <td width="10%" class="tableleft">身份证号</td>
        <td><input type="text" name="d_idCar" onclick="checkCar()" value="4250123151242"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">手机</td>
        <td><input type="text" name="d_phone" onclick="checkPhone()" value="13770121311"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">座机</td>
        <td><input type="text" name="d_telPhone" onclick="checkTelPhone()" value="077012412"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">性别</td>
        <td><input type="radio" name="d_sex" value="1" checked/>男&nbsp;&nbsp;&nbsp;<input type="radio" name="d_sex" value="0"/>女</td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">出生年月</td>
        <td><input type="text" name="d_birthday" value="1999-10-10"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">年龄</td>
        <td><input type="text" name="d_age" onclick="checkAge()" value="18"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">电子邮箱</td>
        <td><input type="text" name="d_email" onclick="checkEmail()" value="xxx@qq.com"/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">所属科室</td>
        <td><select name="d_keshi"><option value="急诊科">急诊科</option><option value="骨科">骨科</option><option value="血液科">血液科</option >
            <option value="妇科">妇科</option><option value="牙科">牙科</option><option value="内科">内科</option><option value="外科">外科</option></select></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">学历</td>
        <td><select name="d_xueli"><option value="专科">专科</option><option value="本科">本科</option><option value="博士">博士</option><option value="博士后">博士后</option>
            <option value="硕士">硕士</option><option value="研究生">研究生</option></select></td>
    </tr>
	<tr>
        <td width="10%" class="tableleft">备注</td>
        <td><textarea name="d_desc"></textarea></td>
	</tr>
    <tr>
        <td colspan="2">
			<center>
				<button class="btn btn-primary" type="button" onclick="upload()">添加</button> &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backId">返回列表</button>
			</center>
		</td>
    </tr>
</table>
</form>
</body>
</html>
<script>
    $("#upload").click(function (){
        upload();
    });

    function upload() {
        let windowId = layer.load();
        $.ajax({
            type: "POST",
            url: "/doctor/addDoctor",
            data: $("#myForm").serialize(),//主要是分页和多条件参数数据
            dataType: "json",
            success: function (vo) {
                layer.close(windowId);
                if (vo.code == 200){
                    layer.msg("添加成功!");
                }else {
                    layer.msg(vo.msg)
                }
            }
        });
    }
    function checkName(){
        layer.tips("请输入2-4位有效名字","input:eq(0)",{tipsMore:true,tips:2});
    }
    function checkCar(){
        layer.tips("请输入18位有效身份证号","input:eq(1)",{tipsMore:true,tips:2});
    }
    function checkTelPhone(){
        layer.tips("请输入6位有效电话号","input:eq(3)",{tipsMore:true,tips:2});
    }
    function checkPhone(){
        layer.tips("请输入11位有效手机号","input:eq(2)",{tipsMore:true,tips:2});
    }
    function checkAge(){
        layer.tips("请输入0-99有效年龄","input:eq(7)",{tipsMore:true,tips:2});
    }
    function checkEmail(){
        layer.tips("请输入正确邮箱xx@qq.com","input:eq(8)",{tipsMore:true,tips:2});
    }
</script>
